package com.mall.goods.controller;

import com.mall.commons.utils.CommonResult;
import com.mall.goods.service.PmsProductAttributeService;
import com.mall.model.vo.CommonPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/productAttribute")
public class PmsProductAttributeController {

    @Autowired
    private PmsProductAttributeService pmsProductAttributeService;


    /**
     * 根据分类查询属性列表或参数列表
     *
     * @return
     */
    @GetMapping("/list/{cid}")
    public CommonResult list(@PathVariable("cid") Integer cid, Integer type, Integer pageNum, Integer pageSize) {
        log.info("cid:{},type:{},pageNum:{},pageSize:{}", cid, type, pageNum, pageSize);
        CommonPage commonPage = pmsProductAttributeService.list(cid, type, pageNum, pageSize);
        return CommonResult.success(commonPage);
    }
}
